import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import type {RouteRecordRaw} from "vue-router"
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/index',
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/HomeView.vue'),
    children:[
      {
        path: '/index',
        name: 'index',
        component: () => import('@/views/index/index.vue'),
      },
      {
        path: '/dataManage',
        name: 'dataManage',
        component: () => import('@/views/dataManage/index.vue'),
      },
      {
        path: '/ecological',
        name: 'ecological',
        component: () => import('@/views/ecological/index.vue'),
      },
      {
        path: '/health',
        name: 'health',
        component: () => import('@/views/health/index.vue'),
      },
      {
        path: '/safety',
        name: 'safety',
        component: () => import('@/views/safety/index.vue'),
      },
      {
        path: '/traffic',
        name: 'traffic',
        component: () => import('@/views/traffic/index.vue'),
      },
      {
        path: '/culture',
        name: 'culture',
        component: () => import('@/views/culture/index.vue'),
      },  
      {
        path: '/feature',
        name: 'feature',
        component: () => import('@/views/feature/index.vue'),
      },
      {
        path: '/orderly',
        name: 'orderly',
        component: () => import('@/views/orderly/index.vue'),
      },
      {
        path: '/diverse', 
        name: 'diverse',
        component: () => import('@/views/diverse/index.vue'),
      },
      {
        path: '/innovation',
        name: 'innovation', 
        component: () => import('@/views/innovation/index.vue'),
      },
      {
        path: '/effective',
        name: 'effective',
        component: () => import('@/views/effective/index.vue'),
      },
    ]
  },
]
const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes,
})

router.beforeEach((to, from, next) => {
  next();
})

export default router
